Skip to content

feat: wrap method now accepts resource as override in Context object. #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2020

Conversation

dackers86
Copy link
Member

Description

As part of trying to test the extensions/firestore-bigquery-export module. We need to introduce the ability to set the resource key values (the types already support this, just this change is missing). Specifically, this line will fail when using the function wrap helper with cannot read property 'name' of undefined. This change allows us to specify the resource values needed for the wrapped cloud function trigger.

Code sample

const wrapped = functionsTest.wrap(require("../src/index").fsexportbigquery);
wrapped(docChange, {
  eventId: "test",
  resource: {
    name: "test",
  },
});

@dackers86 dackers86 marked this pull request as ready for review March 25, 2020 16:42
@Salakar
Copy link
Member

Salakar commented Mar 25, 2020

cc @laurenzlong for review - thanks!

Copy link
Contributor

@laurenzlong laurenzlong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also add "resource" to the EventContextOptions type? https://github.com/firebase/firebase-functions-test/blob/master/src/main.ts#L28

@dackers86
Copy link
Member Author

Could you also add "resource" to the EventContextOptions type? https://github.com/firebase/firebase-functions-test/blob/master/src/main.ts#L28

@laurenzlong Added resource types. Thanks

@laurenzlong laurenzlong changed the title fix: allow resource key in options feat: wrap method now accepts resource in ContextOptions. Apr 15, 2020
@laurenzlong laurenzlong changed the title feat: wrap method now accepts resource in ContextOptions. feat: wrap method now accepts resource as override in Context object. Apr 15, 2020
@laurenzlong laurenzlong merged commit 8ec6d63 into firebase:master Apr 15, 2020
@laurenzlong
Copy link
Contributor

@dackers86 this has been published in v0.2.1

@dackers86 dackers86 deleted the @dackers86/resource-key branch June 17, 2020 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants